package structuralModel.combinationModel.organization;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 功能描述:物理边界根组件
 * 2024/08/21
 *
 * @author ZhangYi
 */
public class PhysicalBoundaryRootCompoent extends PhysicalBoundaryCompoent {


	public PhysicalBoundaryRootCompoent() {
	}

	public PhysicalBoundaryRootCompoent(PhysicalBoundary physicalBoundary) {
		super(physicalBoundary);
		PhysicalBoundaryCompoent physicalBoundaryCompoent = new PhysicalBoundaryLevelCompoent(physicalBoundary);
		physicalBoundaryCompoentMapIndex.put(physicalBoundary.getParentCode(), physicalBoundaryCompoent);
	}


	@Override
	protected void addElement(PhysicalBoundaryCompoent e) {
		physicalBoundaryCompoentList.add(e);
		physicalBoundaryCompoentMapIndex.put(e.getPhysicalBoundary().getParentCode(), e);
	}

	@Override
	protected void removeElement(PhysicalBoundaryCompoent e) {
		physicalBoundaryCompoentList.remove(e);
		physicalBoundaryCompoentMapIndex.remove(e);
	}


	@Override
	protected PhysicalBoundaryCompoent getElement(String parentCode) {
		return physicalBoundaryCompoentMapIndex.containsKey(parentCode) ? physicalBoundaryCompoentMapIndex.get(parentCode) : null;
	}

	@Override
	public void queryAll() {
		System.out.println("物理边界根组件,节点信息为"+ this.getPhysicalBoundary());
		for (PhysicalBoundaryCompoent physicalBoundaryCompoent : physicalBoundaryCompoentList) {
			physicalBoundaryCompoent.queryAll();
		}
	}
}
